<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
</html>

<script>
  let hd = `
        <h1>houdunren</h1>
        <span>后盾人</span>
        <h2>hdcms</h2>
    `;

  let reg = /<(h[1-6])>([\s\S]+)<\/\1>/gi;

  let res = hd.replace(reg, (p0, p1, p2) => {
    console.log(p0, p1, p2);

    return `<p>${p2} </p>`;
  });

  console.log(res);
</script>
